package com.example.course.utils;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig  implements WebMvcConfigurer {
    //设置文件虚拟路径映射
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //localhost/song
        //C:\course\
        registry.addResourceHandler("/course/**").addResourceLocations("file:C:\\course\\course\\");
        //localhost/song
        //C:\course\
        registry.addResourceHandler("/school/**").addResourceLocations("file:C:\\course\\school\\");
        //C:\course\
        registry.addResourceHandler("/teacher/**").addResourceLocations("file:C:\\course\\teacher\\");
        //C:\course\
        registry.addResourceHandler("/student/**").addResourceLocations("file:C:\\course\\student\\");
    }

}
